﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Login</title>
    <link href="@Url.Content("~/Content/dwz/themes/css/login.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/dwz/js/jquery-1.7.1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/js/common.js")" type="text/javascript"></script>
     <script type="text/javascript">
         var FromUrl = getQueryStringByName("FromUrl");
         if (!FromUrl) {
             FromUrl = encodeURIComponent("/Home/");
         }
         $(function () {
             $(".login-text").focus(function () {
                 $(this).addClass("login-text-focus");
             }).blur(function () {
                 $(this).removeClass("login-text-focus");
             });

             $(document).keydown(function (e) {
                 if (e.keyCode == 13) {
                     dologin();
                 }
             });
             $("#btnLogin").click(function () {
                 dologin();
             });

             function dologin() {
                 var username = $("#txtUsername").val();
                 var password = $("#txtPassword").val();
                 if (username == "") {
                     alert("账号不能为空!");
                     $("#txtUsername").focus();
                     return;
                 }
                 if (password == "") {
                     alert("密码不能为空!");
                     $("#txtPassword").focus();
                     return;
                 }
                 $.ajax({
                     type: 'GET', cache: false, dataType: 'json',
                     url: '/api/Account/',
                     data: [
                     { name: 'username', value: username },
                     { name: 'password', value: password }
                     ],
                     success: function (result) {
                         if (!result) {
                             alert("登陆失败，账号或密码有误！");
                             $("#txtUsername").focus();
                             return;
                         } else {
                             location.href = decodeURIComponent(FromUrl);
                         }
                     },
                     error: function () {
                         alert("发送系统错误，请与系统管理员联系！");
                     },
                     beforeSend: function () {
                         $("#btnLogin").attr("disabled", true);
                     },
                     complete: function () {
                         $("#btnLogin").attr("disabled", false);
                     }
                 });
             }
         });
    </script>
</head>
<body>
<div id="login">
		<div id="login_header">
			<h1 class="login_logo">
				<a href="http://www.jieysoft.com" target="_blank"><img src="@Url.Content("~/Content/dwz/themes/default/images/login_logo.gif")" /></a>
			</h1>
			<div class="login_headerContent">
				<div class="navList">
					<ul>
						<li><a href="#">设为首页</a></li>
						<li><a href="http://www.jieysoft.com" target="_blank">反馈</a></li>
						<li><a href="doc/dwz-user-guide.pdf" target="_blank">帮助</a></li>
					</ul>
				</div>
				<h2 class="login_title"><img src="@Url.Content("~/Content/dwz/themes/default/images/login_title.png")" /></h2>
			</div>
		</div>
		<div id="login_content">
			<div class="loginForm">
				<form >
					<p>
						<label>用户名：</label>
						<input type="text" name="username" id="txtUsername" size="20" class="login_input" />
					</p>
					<p>
						<label>密码：</label>
						<input type="password" name="password" id="txtPassword" size="20" class="login_input" />
					</p>
					<p>
						<label>验证码：</label>
						<input class="code" type="text" size="5" />
						<span><img src="@Url.Content("~/Content/dwz/themes/default/images/header_bg.png")" alt="" width="75" height="24" /></span>
					</p>
					<div class="login_bar">
						<input class="sub" type="button" id="btnLogin" value=" " />
					</div>
				</form>
			</div>
			<div class="login_banner"><img src="@Url.Content("~/Content/dwz/themes/default/images/login_banner.jpg")" /></div>
			<div class="login_main">
				<ul class="helpList">
					<li><a href="#">下载驱动程序</a></li>
					<li><a href="#">如何安装密钥驱动程序？</a></li>
					<li><a href="#">忘记密码怎么办？</a></li>
					<li><a href="#">为什么登录失败？</a></li>
				</ul>
				<div class="login_inner">
					<p>您可以使用 网易网盘 ，随时存，随地取</p>
					<p>您还可以使用 闪电邮 在桌面随时提醒邮件到达，快速收发邮件。</p>
					<p>在 百宝箱 里您可以查星座，订机票，看小说，学做菜…</p>
				</div>
			</div>
		</div>
		<div id="login_footer">
			Copyright &copy; 2012 www.jieysoft.com Inc. All Rights Reserved.<br />
            <span id="clock" ></span>
		</div>
	</div>
</body>
</html>
